package com.app.micaihu.bean.game;

import android.text.TextUtils;

import com.app.micaihu.app.AppApplication;
import com.app.micaihu.bean.news.ShareBean;
import com.app.micaihu.bean.speak.ILaud;
import com.app.micaihu.configure.AppConfigTools;
import com.app.micaihu.configure.TypeConstant;
import com.app.utils.util.AppTools;

import java.util.List;

/**
 * Created by linkai on 2017/3/15.
 * 游戏攻略详情
 */

public class GameRaidersContent extends ShareBean implements ILaud {


    private String articleContent;//文章内容
    private String articleTitle;//标题
    private String articleType;//文章类型 24.图文攻略 25.视频攻略
    private String commentNum;//评论总数
    private String praiseNum;//点赞总数
    private String dislikeNum;//点踩总数
    private String publishTime;//发布时间
    private String isCollect;//是否收藏
    private String authorRankIcon;//作者军衔图标
    private String authorRankName;//作者军衔名称
    private String status;//关注状态 0未关注 1已关注 2互相关注
    private String shareNum;//分享总数
    private String vip;//加V状态 0不加v 1加v
    private String appIcon;//缩略图icon
    private String appName;//app名称
    private String appSize;//app大小
    private String downloadNum;//下载量
    private String downloadUrl;//下载地址
    private String packageName;//包名
    private String plotImg;//视频封面图
    private String videoCurl;//云视频地址
    private String videoUrl;//视频外链地址
    private String informTitle;//宣传标题
    private String informContent;//宣传内容
    private String slogan;//游戏描述语
    private String gameId;//游戏id
    private String isInstall;//是否安装游戏 0 已安装  非0未安装

    public String getGameId() {
        return gameId;
    }

    public void setGameId(String gameId) {
        this.gameId = gameId;
    }

    private List<GameRaidersEntity> aboutList;//相关游戏攻略

    List<GameRelated> relatedGame;//相关游戏

    private boolean like;//点赞或者不喜欢

    public boolean getLikeOrDisLike() {
        return like;
    }

    public void setLike(boolean like) {
        this.like = like;
    }


    public String getDownloadUrl() {
        return downloadUrl;
    }

    public void setDownloadUrl(String downloadUrl) {
        this.downloadUrl = downloadUrl;
    }

    public String getAppIcon() {
        return appIcon;
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public String getAppSize() {
        return appSize;
    }

    public void setAppSize(String appSize) {
        this.appSize = appSize;
    }

    public String getArticleTitle() {
        return articleTitle;
    }

    public void setArticleTitle(String articleTitle) {
        this.articleTitle = articleTitle;
    }

    public String getArticleType() {
        return articleType;
    }

    public void setArticleType(String articleType) {
        this.articleType = articleType;
    }

    public String getDownloadNum() {
        return TextUtils.isEmpty(downloadNum) ? "0" : downloadNum;
    }

    public void setDownloadNum(String downloadNum) {
        this.downloadNum = downloadNum;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public void setAppIcon(String appIcon) {
        this.appIcon = appIcon;
    }

    public String getVideoCurl() {
        return videoCurl;
    }

    public void setVideoCurl(String videoCurl) {
        this.videoCurl = videoCurl;
    }

    public String getVideoUrl() {
        return videoUrl;
    }

    public void setVideoUrl(String videoUrl) {
        this.videoUrl = videoUrl;
    }

    public String getPlotImg() {
        return plotImg;
    }

    public void setPlotImg(String plotImg) {
        this.plotImg = plotImg;
    }

    public String getArticleContent() {
        return articleContent;
    }

    public void setArticleContent(String articleContent) {
        this.articleContent = articleContent;
    }

    public String getCommentNum() {
        return commentNum;
    }

    public void setCommentNum(String commentNum) {
        this.commentNum = commentNum;
    }

    public String getPraiseNum() {
        return praiseNum;
    }

    public void setPraiseNum(String praiseNum) {
        this.praiseNum = praiseNum;
    }

    public String getDislikeNum() {
        return dislikeNum;
    }

    public void setDislikeNum(String dislikeNum) {
        this.dislikeNum = dislikeNum;
    }

    public String getPublishTime() {
        return publishTime;
    }

    public void setPublishTime(String publishTime) {
        this.publishTime = publishTime;
    }

    public boolean getIsCollect() {
        if("1".equals(isCollect)){
            return true;
        }
        return false;
    }

    public void setIsCollect(String isCollect) {
        this.isCollect = isCollect;
    }

    public String getAuthorRankIcon() {
        return authorRankIcon;
    }

    public void setAuthorRankIcon(String authorRankIcon) {
        this.authorRankIcon = authorRankIcon;
    }

    public String getAuthorRankName() {
        return authorRankName;
    }

    public void setAuthorRankName(String authorRankName) {
        this.authorRankName = authorRankName;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getShareNum() {
        return shareNum;
    }

    public void setShareNum(String shareNum) {
        this.shareNum = shareNum;
    }

    public String getVip() {
        return vip;
    }

    public void setVip(String vip) {
        this.vip = vip;
    }

    public String getInformTitle() {
        return informTitle;
    }

    public void setInformTitle(String informTitle) {
        this.informTitle = informTitle;
    }

    public String getInformContent() {
        return informContent;
    }

    public void setInformContent(String informContent) {
        this.informContent = informContent;
    }

    public String getSlogan() {
        return slogan;
    }

    public void setSlogan(String slogan) {
        this.slogan = slogan;
    }

    public List<GameRaidersEntity> getAboutList() {
        return aboutList;
    }

    public void setAboutList(List<GameRaidersEntity> aboutList) {
        this.aboutList = aboutList;
    }

    public List<GameRelated> getRelatedGame() {
        return relatedGame;
    }

    public void setRelatedGame(List<GameRelated> relatedGame) {
        this.relatedGame = relatedGame;
    }

    @Override
    public String getNewsId() {
        return articleId;
    }

    @Override
    public String getICommentId() {
        return "";
    }

    @Override
    public String getIParentCmtId() {
        return "";
    }

    @Override
    public String getIType() {
        return "";
    }

    @Override
    public String getILaudOperateType() {
        return getLikeOrDisLike() ? TypeConstant.ZAN_NORMAL : TypeConstant.ZAN_DISLIKE;
    }

    @Override
    public String getILaudNum() {
        if(getLikeOrDisLike()){
            return getPraiseNum();
        }else{
            return  getDislikeNum();
        }
    }

    @Override
    public String getILaudType() {
        return "0";
    }

    @Override
    public void setILaudNum(String iLaudNum) {
        if(getLikeOrDisLike()){
            setPraiseNum(iLaudNum);
        }else{
            setDislikeNum(iLaudNum);
        }
    }

    @Override
    public String getIToUid() {
        return "";
    }

    @Override
    public void setIToUid(String toUid) {

    }


    /**
     * 获取下载的游戏是否安装
     * @return
     */
    public boolean isinstall(){
        if(AppConfigTools.installValue != 0){
            //如果有应用安装或卸载 则每次都去获取是否安装
            return AppTools.isAppInstall(AppApplication.getInstance(), packageName);
        }
        if(TextUtils.isEmpty(isInstall)){
            //如果等于空 说明没有判断过，那么进行判断
            boolean b = AppTools.isAppInstall(AppApplication.getInstance(),packageName);
            if(b){
                isInstall = "0";
            }else{
                isInstall = "1";
            }
        }
        return TextUtils.equals(isInstall,"0");
    }
}
